package personal.jinhui.paprika.providers;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
 
public class SqliteHelper extends SQLiteOpenHelper {
    public SqliteHelper(Context context, String name, CursorFactory factory, int version) {
        super(context, name, factory, version);
    }
 
    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql = "create table " + UserDataMeta.AccountsTable.TABLE_NAME
                + "(" + UserDataMeta.AccountsTable._ID
                + " INTEGER PRIMARY KEY AUTOINCREMENT,"
                + UserDataMeta.AccountsTable.JID
                + " TEXT,"
                + UserDataMeta.AccountsTable.PASSWORD
                + " TEXT,"
                + UserDataMeta.AccountsTable.FULLJID
                + " TEXT,"
                + UserDataMeta.AccountsTable.AVATARID
                + " TEXT);";
        db.execSQL(sql);

    	sql = "create table " + UserDataMeta.MessagesTable.TABLE_NAME
                + "(" + UserDataMeta.MessagesTable._ID
                + " INTEGER PRIMARY KEY AUTOINCREMENT,"
                + UserDataMeta.MessagesTable.ACCOUNT
                + " TEXT,"
                + UserDataMeta.MessagesTable.TIMESTAMP
                + " TEXT,"
                + UserDataMeta.MessagesTable._FROM
                + " TEXT,"
                + UserDataMeta.MessagesTable._TO
                + " TEXT,"
                + UserDataMeta.MessagesTable.MSGBODY
                + " TEXT,"
                + UserDataMeta.MessagesTable.ISERROR
                + " INTEGER);";
        db.execSQL(sql);
    }
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    }
}
